package com.sinochem.sales.admin.api.feign;

import com.sinochem.sales.admin.api.to.UserTO;
import com.sinochem.sales.common.entity.Result;
import com.sinochem.sales.admin.api.feign.fallback.UserServiceFallbackImpl;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author xuan
 * @date 2017/10/31
 */
@FeignClient(name = "admin-service", fallback = UserServiceFallbackImpl.class)
public interface UserService {
    /**
     * 通过用户名查询用户、角色信息
     *
     * @param userName 用户名
     * @return UserVo
     */
    @GetMapping("/user/findUserByUserName")
    Result<UserTO> findUserByUserName(@RequestParam("userName") String userName);

    /**
     * 通过手机号查询用户、角色信息
     *
     * @param mobile 手机号
     * @return UserVo
     */
    @GetMapping("/user/findUserByMobile/{mobile}")
    Result<UserTO> findUserByMobile(@PathVariable("mobile") String mobile);

    /**
     * 根据OpenId查询用户信息
     *
     * @param openId openId
     * @return UserVo
     */
    @GetMapping("/user/findUserByOpenId/{openId}")
    Result<UserTO> findUserByOpenId(@PathVariable("openId") String openId);
}
